package Homework10.Review;

import Homework04.Manager;

public class Test {
    public static void main(String[] args) {
        NorEmployee jack = new NorEmployee("jack", 8000);
        Manage milan = new Manage("milan", 20000, 300000);

        Test test = new Test();
        test.showEmployeeAnnual(milan);
        test.showEmployeeAnnual(jack);
        test.testWork(jack);
        test.testWork(milan);
    }
    public void showEmployeeAnnual(Employee e) {
        //实现获取任何员工对象的年工资
        System.out.println(e.getAnnual());//动态绑定机制
    }
    public void testWork(Employee e) {//形参为父类，实参可以为子类
        if(e instanceof NorEmployee){
            ((NorEmployee)e).work();
        }else if(e instanceof Manage){
            ((Manage)e).manage();
        }else
        System.out.println("不做处理");
    }
}
